package demo.component;

import demo.config.UserInfo;
import demo.controller.UserController;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 22652
 * Date: 2024-07-07
 * Time: 20:16
 */
@Component
public class UserComponent {

    //@Autowired
    private UserController userController;

    @Resource(name = "u1")
    private UserInfo userInfo1;

    @Resource(name = "u2")
    private UserInfo userInfo2;

    @Autowired
    public UserComponent(UserController userController) {
        this.userController = userController;
    }

    public void doComponent(){
        System.out.println("do component....");
        System.out.println(userInfo1);
        userController.sayHi();
        System.out.println(userInfo2);
    }
}
